import { getHeaderRecommend } from "@/api/lh-api/index";

const state = {
	videoList: [],
};

const getters = {
	categoryRankList(state) {
		return state.videoList.slice(0, 8);
	},
};

const actions = {
	async getVideoList({ commit }) {
		const videoList = await getHeaderRecommend();
		// console.log(videoList);
		commit("SETVIDEOLIST", videoList);
	},
};

const mutations = {
	SETVIDEOLIST(state, videoList) {
		state.videoList = videoList;
	},
};

export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations,
};
